package com.deyuanyun.pic.ctrl.app.service.impl;

import com.deyuanyun.pic.ctrl.app.service.DeviceService;
import com.deyuanyun.pic.ctrl.domain.*;
import com.deyuanyun.pic.ctrl.mapper.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description
 * @author Jerry
 * @date 2016-11-18
 */
@Service
public class DeviceServiceImpl implements DeviceService {

    @Resource
    private EqptAnodesbedMapper eqptAnodesbedMapper;//阳极地床

    @Resource
    private EqptAntiSurgeMapper eqptAntiSurgeMapper;//防浪涌保护器

    @Resource
    private EqptCpJumperMapper eqptCpJumperMapper;//阴极保护跨接线

    @Resource
    private EqptCppowerrMapper eqptCppowerrMapper;//阴保电源

    @Resource
    private EqptCptestStationMapper eqptCptestStationMapper;//阴保测试桩

    @Resource
    private EqptCurrentDrainageMapper eqptCurrentDrainageMapper;//排流地床

    @Resource
    private EqptInsulatedJointMapper eqptInsulatedJointMapper;//绝缘装置

    @Resource
    private EqptReferenceMapper eqptReferenceMapper;//长效参比电极校准

    @Resource
    private EqptSaalAnodeMapper eqptSaalAnodeMapper;//牺牲阳极

    @Override
    public List<EqptCppowerr> selectEqptPower() {
        EqptCppowerrExample cpowerExample= new EqptCppowerrExample();
        cpowerExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptCppowerrMapper.selectByExample(cpowerExample);
    }

    @Override
    public List<EqptCptestStation> selectCptest() {
        EqptCptestStationExample cptestExample = new EqptCptestStationExample();
        cptestExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return   eqptCptestStationMapper.selectByExample(cptestExample);
    }

    @Override
    public List<EqptCurrentDrainage> selectDrain() {
        EqptCurrentDrainageExample drainageExample = new EqptCurrentDrainageExample();
        drainageExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptCurrentDrainageMapper.selectByExample(drainageExample);
    }

    @Override
    public List<EqptInsulatedJoint> selectInsluate() {
        EqptInsulatedJointExample insulatedJointExample = new EqptInsulatedJointExample();
        insulatedJointExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptInsulatedJointMapper.selectByExample(insulatedJointExample);
    }

    @Override
    public List<EqptReference> selectEqptRefence() {
        EqptReferenceExample referenceExample = new EqptReferenceExample();
        referenceExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptReferenceMapper.selectByExample(referenceExample);
    }

    @Override
    public List<EqptSaalAnode> selectSaal() {
        EqptSaalAnodeExample saalAnodeExample = new EqptSaalAnodeExample();
        saalAnodeExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptSaalAnodeMapper.selectByExample(saalAnodeExample);
    }

    @Override
    public List<EqptAntiSurge> selectAnti() {
        EqptAntiSurgeExample antiSurgeExample = new EqptAntiSurgeExample();
        antiSurgeExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptAntiSurgeMapper.selectByExample(antiSurgeExample);
    }

    @Override
    public List<EqptCpJumper> selectCpJumper() {
        EqptCpJumperExample jumperExample = new EqptCpJumperExample();
        jumperExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptCpJumperMapper.selectByExample(jumperExample);
    }

    @Override
    public List<EqptAnodesbed> selectAnode() {
        EqptAnodesbedExample anodesbedExample = new EqptAnodesbedExample();
        anodesbedExample.createCriteria().andDeletedEqualTo((short) 0).andDataStatedEqualTo("20")
                .andIsNewestEqualTo((short) 0);
        return eqptAnodesbedMapper.selectByExample(anodesbedExample);
    }
}
